<template>
  <div  class="content">
    <div>
       <el-button v-for="(it, indexs) in operation" :key="indexs" :loading="loading" :type="it.type"
         @click="changeExamineShow(it.num, it.label)">{{ it.label }}</el-button>
    </div>
    <el-button v-if="showColse" :loading="btnLoading" style="margin-left: 10px;" @click="openClose">取消</el-button>
  </div>
</template>

<script>
  export default {
    name: "actionButton",
    components: {},
    props: {
      taskName: {
        type: String,
        default: ''
      },
      loading: {
        type: Boolean,
        default: false
      },
      showColse: {
        type: Boolean,
        default: false
      },
    },
    data() {
      return {
        operation:[],
        list: [{
            taskName: "发起",
            operation: [{
              label: "提交审核",
              type: "primary",
              num: 1
            }],
          },
          {
            taskName: "单位审核",
            operation: [{
                label: "通过",
                type: "primary",
                num: 1
              },
              {
                label: "不通过",
                type: "danger",
                num: 2
              },
            ],
          },
          {
            taskName: "监管平台接收",
            operation: [{
                label: "通过",
                type: "primary",
                num: 1
              },
              {
                label: "不通过",
                type: "danger",
                num: 2
              },
            ],
          },
          {
            taskName: "监管平台初核",
            operation: [{
                label: "通过",
                type: "primary",
                num: 1
              },
              {
                label: "不通过",
                type: "danger",
                num: 2
              },
            ],
          },
          {
            taskName: "大数据中心复核",
            operation: [{
                label: "通过",
                type: "primary",
                num: 1
              },
              {
                label: "不通过",
                type: "danger",
                num: 2
              },
            ],
          },
          {
            taskName: "监管平台派发",
            operation: [{
              label: "派发",
              type: "primary",
              num: 1
            }],
          },
          {
            taskName: "云服务商处理",
            operation: [{
                label: "通过",
                type: "primary",
                num: 1
              },
              {
                label: "不通过",
                type: "danger",
                num: 2
              },
            ],
          },
          {
            taskName: "用户确认",
            operation: [{
                label: "已解决",
                type: "primary",
                num: 1
              },
              {
                label: "未解决",
                type: "danger",
                num: 2
              },
            ],
          },
          {
            taskName: '',
            operation: [{
              label: '通过',
              type: 'primary',
              num: 1
            }, {
              label: '不通过',
              type: 'danger',
              num: 2
            }]
          },
        ],
      }
    },
    created() {
          this.list.some(item=>{
              if(item.taskName==this.taskName||!item.taskName){
                this.operation=item.operation
                return true
              }
          })
    },
    methods: {
        changeExamineShow(num, label){
          this.$emit('changeExamineShow',num,label)
        },
        openClose(){
          this.$emit('openClose')
        },
    }
  }
</script>

<style lang="scss" scoped>
  .content {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 20px;
  }
</style>
